package com.ym.medical.service.impl;

import com.ym.core.utils.tkmybatis.BaseSVImpl;
import com.ym.medical.dao.ThankMoneyDao;
import com.ym.medical.domain.entity.ThankMoneyEntity;
import com.ym.medical.domain.param.ThankMoneyQueryParam;
import com.ym.medical.domain.param.ThankMoneyUpdateParam;
import com.ym.medical.domain.vo.ThankMoneyListMobileVO;
import com.ym.medical.domain.vo.ThankMoneyListPcVO;
import com.ym.medical.enums.ThankMoneyThankTypeEnum;
import com.ym.medical.service.IThankMoneySV;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
                                
/**
* 答谢金额表Service业务层处理
*
* @author ym
* @date 2020-09-02
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ThankMoneySVImpl extends BaseSVImpl<ThankMoneyEntity,ThankMoneyDao> implements IThankMoneySV {

	/**
	 * 查询答谢金额表列表
	 *
	 * @param queryParam 答谢金额表 查询参数
	 * @return 答谢金额表
	 */
	@Override
	public List<ThankMoneyListPcVO> selectListPC(ThankMoneyQueryParam queryParam) {
		List<ThankMoneyListPcVO> thankMoneys = mapper.selectListPC(queryParam);
		return thankMoneys;
	}

	/**
	 * 新增答谢金额表
	 *
	 * @param updateParam 答谢金额表 新增参数
	 * @return 结果
	 */
	@Override
	public Long insertPC(ThankMoneyUpdateParam updateParam) {
            ThankMoneyEntity entity = updateParam.covert();
		this.insert(entity);
		return entity.getId();
	}

	/**
	 * 修改答谢金额表
	 *
	 * @param updateParam 答谢金额表 修改参数
	 * @return 结果
	 */
	@Override
	public int updateByIdPC(ThankMoneyUpdateParam updateParam) {
            ThankMoneyEntity entity = updateParam.covert();
		int result = this.updateById(entity);
		return result;
	}

	@Override
	public void insertThankMoney(ThankMoneyUpdateParam param) {
		param.setThankType(ThankMoneyThankTypeEnum.CUSTOMER_AMOUNT.getKey());
		ThankMoneyEntity moneyEntity = param.covert();
		insert(moneyEntity);
	}

	@Override
	public List<ThankMoneyListMobileVO> selectListMobile(ThankMoneyQueryParam queryParam) {
		List<ThankMoneyListMobileVO>  thankMoneyListMobileVOS = mapper.selectListMobile(queryParam);
		return thankMoneyListMobileVOS;
	}
}
